package net.bwie.realtime.jtp.dws.log.bean;

import org.apache.flink.types.Row;
import net.bwie.realtime.jtp.dws.log.utils.AnalyzerUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;

import java.sql.Ref;
import java.util.List;

@FunctionHint(output = @DataTypeHint("ROW<keyword STRING>"))
public class IkAnalyzeFunction extends TableFunction<Row> {
    public void eval(String str) throws Exception {
        // 调用工具类进行分词
        List<String> list = AnalyzerUtil.ikAnalyzer(str);
        // 遍历并输出每一项
        for (String s : list) {
            // 正确使用 flink-types 中的 Row.of 方法
            collect(Row.of(s));

        }
    }

    public static void main(String[] args) {
        IkAnalyzeFunction ikAnalyzeFunction = new IkAnalyzeFunction();

    }
}

